/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.fieo.sgee.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author rafael
 */
@Entity
@Table(name = "pontos_energia")
@NamedQueries({@NamedQuery(name = "EnergyPoint.findAll", query = "SELECT e FROM EnergyPoint e"), @NamedQuery(name = "EnergyPoint.findById", query = "SELECT e FROM EnergyPoint e WHERE e.id = :id"), @NamedQuery(name = "EnergyPoint.findByLocalizacao", query = "SELECT e FROM EnergyPoint e WHERE e.localizacao = :localizacao"), @NamedQuery(name = "EnergyPoint.findByDescricao", query = "SELECT e FROM EnergyPoint e WHERE e.descricao = :descricao"), @NamedQuery(name = "EnergyPoint.findByStatus", query = "SELECT e FROM EnergyPoint e WHERE e.status = :status"), @NamedQuery(name = "EnergyPoint.findByDataCriacao", query = "SELECT e FROM EnergyPoint e WHERE e.dataCriacao = :dataCriacao"), @NamedQuery(name = "EnergyPoint.findByDataModificacao", query = "SELECT e FROM EnergyPoint e WHERE e.dataModificacao = :dataModificacao")})
public class EnergyPoint implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "localizacao")
    private String localizacao;
    @Column(name = "descricao")
    private String descricao;
    @Basic(optional = false)
    @Column(name = "status")
    private short status;
    @Basic(optional = false)
    @Column(name = "data_criacao")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dataCriacao;
    @Basic(optional = false)
    @Column(name = "data_modificacao")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dataModificacao;
    @JoinColumn(name = "tipo_ponto_id", referencedColumnName = "id")
    @ManyToOne
    private TypeOfPoint tipoPontoId;

    public EnergyPoint() {
    }

    public EnergyPoint(Integer id) {
        this.id = id;
    }

    public EnergyPoint(Integer id, short status, Date dataCriacao, Date dataModificacao) {
        this.id = id;
        this.status = status;
        this.dataCriacao = dataCriacao;
        this.dataModificacao = dataModificacao;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLocalizacao() {
        return localizacao;
    }

    public void setLocalizacao(String localizacao) {
        this.localizacao = localizacao;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public short getStatus() {
        return status;
    }

    public void setStatus(short status) {
        this.status = status;
    }

    public Date getDataCriacao() {
        return dataCriacao;
    }

    public void setDataCriacao(Date dataCriacao) {
        this.dataCriacao = dataCriacao;
    }

    public Date getDataModificacao() {
        return dataModificacao;
    }

    public void setDataModificacao(Date dataModificacao) {
        this.dataModificacao = dataModificacao;
    }

    public TypeOfPoint getTipoPontoId() {
        return tipoPontoId;
    }

    public void setTipoPontoId(TypeOfPoint tipoPontoId) {
        this.tipoPontoId = tipoPontoId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EnergyPoint)) {
            return false;
        }
        EnergyPoint other = (EnergyPoint) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.fieo.sgee.model.EnergyPoint[id=" + id + "]";
    }

}
